<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>求一组数中的最大值和最小值，以及所在位置的下标。</title>
</head>
<body>
    <script>
        function maxAndMin(arr) {
            var max = Math.max(...arr), indexOfMax = arr.indexOf(max),
            min = Math.min(...arr), indexOfMin = arr.indexOf(min);
            console.log('最大数' + max+ '最小数' + min )
            console.log('最大数位置下标' + indexOfMax + '最大数位置下标' + indexOfMin )
        }
        maxAndMin([1,5,6,88,1156,154,1561,4,2,48,65]) 
    </script>
</body>
</html>